home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / PROCS.ZIP / ARGPARSE.ICN < prev    next >
Text File  |  1992-09-28  |  823b  |  36 lines

  1. ############################################################################
  2. #
  3. #    File:     argparse.icn
  4. #
  5. #    Subject:  Procedure to parse pseudo-command-line
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 14, 1991
  10. #
  11. ###########################################################################
  12. #
  13. #  argparse(s) parses s as if it were a command line and puts the components in
  14. #  in a list, which is returned.
  15. #
  16. #  At present, it does not accept any escape conventions.
  17. #
  18. ############################################################################
  19.  
  20. procedure argparse(s)
  21.    local arglist
  22.    static nonblank
  23.  
  24.    initial nonblank := &cset -- ' \t\n'
  25.  
  26.    arglist := []
  27.  
  28.    s ? {
  29.      while tab(upto(nonblank)) do
  30.         put(arglist, tab(many(nonblank)))
  31.      }
  32.  
  33.    return arglist
  34.  
  35. end
  36.